{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
</head>
<body>
<div>
    <label for="username">用户名:</label>
    <input type="text" id="username" name="username">
    <br/>
    <br/>
</div>
<div>
    <label for="password">密码:</label>&nbsp;
    <input type="password" id="password" name="password">
    <br/>
    <br/>
</div>
<button id="bton_login">登录</button>

<script src="{% static 'jQuery.js' %}"></script>
<script src="{% static 'cookie.js' %}"></script>
<script>
    $("#bton_login").click(function () {
        let username = $("#username").val()
        let password = $("#password").val()
        $.ajax({
            url: '',
            type: 'post',
            data: {
                username: username,
                password: password
            },
            success: function (result) {
                console.log(result)
                console.log(result['token'])
                $.cookie("cookie_token", result['token'])
            }
        })
    })
</script>
</body>
</html>